n = input().split()
x = ['zero','one','two','three','four','five','six','seven','eight','nine']
b = ''
if len(n) != 3:
    b = 'Wrong input'
else:
    for i in n:
        if i not in x:
            b = 'Wrong input'
            break
        b += str(x.index(i))
    if len(b) != 3:
        b = 'Wrong input'

if b != 'Wrong input':
    z = int(b)
    o = False
    while not o:
        if z > 1:
            p = True
            for i in range(2, int(z ** 0.5) + 1):
                if z % i == 0:
                    p = False
                    break
            if p:
                print(z)
                o = True
            else:
                z += 1
        else:
            z += 1
else:
    print(b)
